package com.yang.controller;

import com.yang.pojo.School;
import com.yang.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class ExpressController {

    @Autowired
    private Student student;

    @Autowired
    private School school;


    @RequestMapping("/express-var")
    public String express_var(Model model){
        //添加简单类型的数据
        model.addAttribute("myName","yty");
        model.addAttribute("myAge",23);
        //添加对象类型
        student.setId(1001);
        student.setName("狗子");
        student.setEmail("lmx@qq.com");
        student.setAge(23);
        student.sex="女";

        school.setsAddress("杭州");
        school.setsName("雷音寺");
        student.setMySchool(school);
        model.addAttribute("student",student);
        return "var1";
    }
    @RequestMapping("/i18N")
    public String il8n(Model model){
        return "login";
    }
}
